package com.chuangjiangx.member.coupon.ddd.domain.model;

import lombok.Getter;

/**
 * Created by zhoufushou on 2017/12/16.
 * 卡券状态
 */
@Getter
public enum CouponStatus {
    NOT_RELEASE("未投放", (byte)1),
    RELEASE("投放中", (byte)2),
    STOP_RELEASE("停止投放", (byte)3);

    public final String name;
    public final Byte code;

    CouponStatus(String name, Byte code) {
        this.name = name;
        this.code = code;
    }

    public static CouponStatus get(Byte code){
        for(CouponStatus back : values()){
            if(back.code.equals(code)){
                return back;
            }
        }
        return null;
    }
}
